/* ✅ تنسيق عام للجسم */
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(to bottom right, #eef2f3, #cfd9df);
  color: #222;
  direction: rtl;
  max-width: 100vw; /* منع التمدد الأفقي */
  overflow-x: hidden; /* منع التمرير الأفقي */
}

/* ✅ تطبيق box-sizing على كل العناصر */
* {
  box-sizing: border-box;
}

/* ✅ رأس وتذييل الصفحة */
header, footer {
  background-color: #002855;
  color: #fff;
  padding: 20px;
  text-align: center;
  user-select: none;
}

/* ✅ شريط التنقل */
nav {
  background-color: #003f88;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px;
  gap: 15px;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: bold;
  background-color: #0059b3;
  transition: background-color 0.3s ease;
  cursor: pointer;
  user-select: none;
}

nav a.active,
nav a:hover {
  background-color: #0077cc;
}

/* ✅ الأقسام */
section {
  display: none;
  padding: 20px 10px; /* تقليل البادينغ للهواتف */
  max-width: 100%;
  margin: 10px auto;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  animation: fadeIn 0.5s ease forwards;
  user-select: text;
}

section.active {
  display: block;
}

@keyframes fadeIn {
  from {opacity: 0; transform: translateY(15px);}
  to {opacity: 1; transform: translateY(0);}
}

/* ✅ العناوين والوصف */
.tag {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 15px;
}

.desc {
  font-size: 20px;
  margin-bottom: 25px;
  line-height: 1.4;
}

/* ✅ الكود */
pre {
  background: #111;
  color: #f8f8f2;
  padding: 15px;
  border-radius: 10px;
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 16px;
  white-space: pre-wrap;
  user-select: all;
  margin-bottom: 25px;
  max-height: 300px;
  overflow-y: auto;
}

/* ✅ الأزرار */
.buttons {
  margin-top: 10px;
}

.buttons button {
  background: #f9a825;
  border: none;
  color: #222;
  font-weight: bold;
  padding: 12px 25px;
  margin: 0 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.3s ease;
  user-select: none;
}

.buttons button:hover {
  background: #c17900;
  color: white;
}

/* ✅ تنسيق إضافي */
.nmnm {
  text-align: center;
}

.lop {
  width: 100%;
  max-width: 1000px;
  height: auto;
  margin: 0 auto;
}

/* ✅ الحاوية الرئيسية */
.container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
  padding: 10px;
  width: 100%;
  max-width: 1000px;
}

/* ✅ العناصر داخل الحاوية */
.item {
  flex: 1 1 280px;
  margin: 10px;
  padding: 20px;
  background-color: #f2f2f2;
  border-radius: 8px;
  text-align: center;
}

/* ✅ تجاوب مع الهواتف الصغيرة */
@media (max-width: 600px) {
  .item {
    flex: 1 1 100%;
    font-size: 14px;
  }
}

/* ✅ تجاوب مع الأجهزة اللوحية */
@media (min-width: 601px) and (max-width: 1024px) {
  .item {
    flex: 1 1 45%;
    font-size: 16px;
  }
}

/* ✅ تجاوب مع الشاشات الكبيرة */
@media (min-width: 1025px) {
  .item {
    flex: 1 1 30%;
    font-size: 18px;
  }
}

/* ✅ تحسينات إضافية للهواتف */
@media (max-width: 480px) {
  nav {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  nav a {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 16px;
  }

  .buttons button {
    width: 100%;
    margin: 10px 0;
  }
}
